/*-------------------------------------------------------------------------

***************** Modification History ***********************************
   @doc
   @module comm.c - Header for communication functions |
   @end

 * Revision History
 * Date						Author								Purpose			
 * 31-Aug-2005			CHIA Lee Chyi				To resolve the Vx510 Combo Modem problem
 
$Log: /SoftPay/SPK2SIM/Source/Include/comm.h $
**************************************************************************

   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.

---------------------------------------------------------------------------*/

#ifndef VSCOMM_H
#define VSCOMM_H

#include <transact.h>

/* Host Comm Link Type Definitions, must be kept current with GDHDT.H */
/* NOTE:  Zero may not be used as a COMM Type */
#define NO_COMM                     0
#define MODEM_COMM                  1
#define ISDN_COMM                   2
#define COMM_3101                   4
#define COMM_3201                   5
#define MOBITEX_COMM             6
#define CONNECT_ONE               7

#define SPD_MODEM_COMM              99

/* ISDN Mode Type Definitions, must be kept current with ICT.h */
#define ISDN_LOCAL_MODE             1
#define ISDN_TRANSPARENT_MODE       2
#define ISDN_BLIND_MODE             3

/* Inter Character Timeout for VISA Communication */
#define VS_RXPARITY             (-25)
#define VS_RXLRC                (-26)

#define RX_CONTROL              1
#define RX_RESPONSE             2
#define RX_MULTI_TRANS          3

#define NO_PARITY           0
#define EVEN_PARITY         1
#define ODD_PARITY          2

// xhayes_send_cmd adds AT at the beginning and /r at the end of the string
#define XHAYES_STRING_FRAME		3

// Data format
#define SDLC	7

// Modem types

#define	ASPEN_MODEM_ID		2
#define	TDK_MODEM_ID			3
#define	CONNEXANT_MODEM_ID	4
#define 	CONNEXANT_MODEM_ID_COMBO	22		//LeeChyi - 31082005: To resolve the Vx510 Combo Modem problem

#define fModem()                (obCommunication.inLinkType == COMM_3101)// imam 

typedef struct comm_struct
{
	int             inLinkType;
	VS_BOOL         fLinkUp;

	void *Data;

	int  (*inInitialize)(void *);
	int (*inBegin)(void *, int, VS_BOOL);
	int (*inCheck)(void *);
	int (*inSend)(void *, char *, int, VS_BOOL, int, long);
	int (*inReceive)(void *, char *, int, int, long);
	int (*inFlush)(void);
	int (*inEnd)(void *);
	int (*inDeinitialize)(void *);
} COMM_OBJECT;

#define COMM_OBJECT_SIZE sizeof(COMM_OBJECT)

extern COMM_OBJECT obCommunication;

int inInitCOMM_OBJECT (TRANSACTION_OBJECT *pobTran);
int inInitializeComm (int inCommLinkType);
int inSetCPTCommMode(void);
int inTimeout_TICKS_To_10MS (int inTicks);
int inTimeout_SEC_To_TICKS (int inSec);
int inGetCommDevicePath (char chPort, char *szPath);
void vdGetIcto(int *pinIcto);
int inDefaultCustomCommInit (TRANSACTION_OBJECT *pobTran);
int COMM_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);

//UCLapp 'C' Prototypes
void vdInitUCLObjects (void);

extern void ACTIVITY_LOG(const char* pszLogMessage); 

#endif   /* vscomm_H */
